/*
 * Copyright 2014 Semidata. All rights reserved.
 */
package com.semidata.rtd.engine.main;

import com.semidata.rtd.core.redis.RedisClient;
import com.semidata.rtd.core.redis.RedisResponseHandler;
import com.semidata.rtd.core.service.ServiceManager;
import com.semidata.rtd.engine.job.AsyncTask;
import com.semidata.rtd.engine.job.Job;

/**
 * @author shewei@semidata.com, She Wei
 * 
 */
public class TestTask2 extends AsyncTask {

	private static RedisClient redisClient = ServiceManager
	        .getService(RedisClient.class);

	public TestTask2(Job job) {
		super(job, 0);
	}

	@Override
	public void run() {

		final String key = "key" + (int) (Math.random() * 100);
		final String field = "field" + (int) (Math.random() * 100);
		redisClient.get(key, field, 50, new RedisResponseHandler() {
			@Override
			public void handle(Object result, Exception cause) {

				// if (cause == null)
				// System.out.println("test2: key=" + key + " field=" + field
				// + " value=" + new String((byte[]) result));
				// else
				// cause.printStackTrace();
				done(cause);

			}
		});
	}
}